import {BaseColumn, BasePage} from "../../../../ts/type";
import {replace, stampToDatetimeText} from "../../../../ts/util";
import {h} from "vue";

export let columnCodeColumnInit = (page: BasePage) => {
    page.columns.push(replace(new BaseColumn('index', ''), {
        width: 60
    }))
    page.columns.push(replace(new BaseColumn('id', 'ID'), {
        sorter: 'default',
        defaultSortOrder: 'descend',
        width: 80
    }))
// field column auto
// #bind.field.fieldCode#
    page.columns.push(new BaseColumn('fieldCode', '属性编码'))
// $bind.field.fieldCode$

// #bind.field.codeName#
    page.columns.push(new BaseColumn('codeName', '编码模板名称'))
// $bind.field.codeName$

// field label auto
    page.columns.push(new BaseColumn('createBy', '创建人'))
    page.columns.push(new BaseColumn('updateBy', '修改人'))
    page.columns.push(replace(new BaseColumn('createTime', '创建时间'), {
        render: (row: any) => {
            return h('span', stampToDatetimeText(row.createTime))
        }
    }))
    page.columns.push(replace(new BaseColumn('updateTime', '修改时间'), {
        render: (row: any) => {
            return h('span', stampToDatetimeText(row.updateTime))
        }
    }))
}